<template>
  <el-card shadow="always" class="info-card-wrapper">
    <div class="content-con">
      <div class="left-area" :style="{background: color, width: leftWidth}">
        <i :class="['fa','fa-'+icon]" :style="{marginTop:'40px',color:'#fff','fontSize':'36px'}"></i>
      </div>
      <div class="right-area" :style="{width: rightWidth}">
        <div>
          <slot></slot>
        </div>
      </div>
    </div>
  </el-card>
</template>

<script>
export default {
  name: "InforCard",
  props: {
    left: {
      type: Number,
      default: 36
    },
    color: {
      type: String,
      default: "#2d8cf0"
    },
    icon: {
      type: String,
      default: ""
    },
    iconSize: {
      type: Number,
      default: 20
    },
    shadow: {
      type: Boolean,
      default: false
    }
  },
  computed: {
    leftWidth() {
      return `${this.left}%`;
    },
    rightWidth() {
      return `${100 - this.left}%`;
    }
  }
};
</script>

<style lang="less">
.info-card-wrapper .el-card__body {
  height: 100%;
  padding: 0;
}
.common {
  float: left;
  height: 100%;
  display: table;
  text-align: center;
}
.size {
  width: 100%;
  height: 100%;
}
.middle-center {
  display: table-cell;
  vertical-align: middle;
}
.info-card-wrapper {
  .size;
  overflow: hidden;
  .ivu-card-body {
    .size;
  }
  .content-con {
    .size;
    position: relative;
    .left-area {
      .common;
      & > .icon {
        .middle-center;
      }
    }
    .right-area {
      .common;
      & > div {
        .middle-center;
      }
    }
  }
  .count-style {
    font-size: 50px;
    color: #515a6e;
  }
  .right-area p {
    margin: 0;
  }
}
</style>
